package com.example.asapp.demo.curd;

import com.example.asapp.demo.curd.mapper.CurdDao;
import com.example.asapp.demo.curd.mapper.CurdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CurdServiceImpl implements CurdService{

    @Autowired
    CurdDao curdDao;

    @Autowired
    CurdMapper curdMapper;

    @Override
    public List<CurdVO> findAll() {
        return curdDao.findAll();
    }

    @Override
    public CurdVO add(CurdVO curd) {
        return curdDao.save(curd);
    }

    @Override
    public CurdVO update(CurdVO curd) {
        return curdDao.save(curd);
    }

    @Override
    public void deleteById(String id) {
        curdDao.deleteById(id);
    }

    @Override
    public List<CurdVO> listAll() {
        return curdMapper.listAll();
    }
}
